package org.cloudnote.controller;

import org.cloudnote.service.UserService;
import org.cloudnote.util.NoteResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    // /user/regist.do
    // http://localhost
    @RequestMapping("/regist.do")
    @ResponseBody
    public NoteResult regist(String name,String password,String nick){
        NoteResult result = userService.regist(name,password,nick);
        return result;
    }


    @RequestMapping("/login.do")
    @ResponseBody
    public NoteResult userLogin(String name,String password){
        NoteResult result = userService.checkLogin(name,password);
        return result;
    }

}
